//
//  UIImageView+Rotate.m
//  LJLAirCleanr
//
//  Created by make on 2017/4/18.
//  Copyright © 2017年 make. All rights reserved.
//

#import "UIImageView+Rotate.h"

@implementation UIImageView (Rotate)

- (void)rotateWithImageView{
    
    CABasicAnimation * rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; //让其在z轴旋转
    rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 ];//旋转角度
    rotationAnimation.duration = 1; //旋转周期
    rotationAnimation.cumulative = YES;//旋转累加角度
    rotationAnimation.repeatCount = MAXFLOAT;//旋转次数
    [self.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];

}

- (void)stopRotate{

    [self.layer removeAllAnimations];

}
@end
